/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DatabasePack;

import java.sql.Connection;
import java.sql.Statement;
import java.sql.PreparedStatement;
import java.sql.*;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.Timer;
import javax.swing.JFrame;

/**
 *
 * @author abdosalah
 */
public class DatabaseConnection {

    private static final String host = "jdbc:derby://localhost:1527/bank";
    public static String user = "abdo";
    public static String password = "123";
    public static Connection connection;
    public static Statement statement;
    
    public static boolean OpenConnction() {

        try {
            //this open the connection and take host name from jdbc and user name and password
            connection = DriverManager.getConnection(host, user, password);
            statement = connection.createStatement(); 
       //     Backup backup = new Backup();
     //       backup.BackupDatabase();
            return true;
        } catch (SQLException e) {
            System.out.println("Error in connection");
            return false;
        }

    }
}
